package com.kun.log;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;

/**
 * @author kun.li
 */
@Aspect
@Slf4j
public class LogAspect {


    @Around(value = "@annotation(controllerLog)")
    public Object around(ProceedingJoinPoint proceedingJoinPoint, Log controllerLog) {
        String title = controllerLog.title();
        log.info("title:{}",title);
        try {
            return proceedingJoinPoint.proceed();
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
    }
}
